package com.kh.pajx.sop.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.kh.pajx.sop.base.BaseDaoImpl;
import com.kh.pajx.sop.dao.IClassInfoDao;
import com.kh.pajx.sop.domain.ClassInfo;

/**
 * 班级信息数据持久化操作实现类
 * @author:	azzcsimp
 * @Createdate:	2014年8月14日 下午3:58:43
 */
@Repository
@SuppressWarnings("unchecked")
public class ClassInfoDaoImpl extends BaseDaoImpl<ClassInfo> implements IClassInfoDao {

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoList()
	 */
	@Override
	public List<ClassInfo> findClassInfoList() {
		return getSession().createQuery(//
				"FROM ClassInfo c ORDER BY c.clsName")//
				.list();
	}

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoList(int)
	 */
	@Override
	public List<ClassInfo> findClassInfoList(int statusFlag) {
		return getSession().createQuery(//
				"FROM ClassInfo c WHERE c.clsStatusFlag = ? ORDER BY c.clsName")//
				.setParameter(0, statusFlag)//
				.list();
	}

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoList(java.lang.String, java.lang.String)
	 */
	@Override
	public List<ClassInfo> findClassInfoList(String sclId, String graId) {
		return getSession().createQuery(//
				"FROM ClassInfo c WHERE c.sclId = ? AND c.graId = ? ORDER BY c.clsName")//
				.setParameter(0, sclId)//
				.setParameter(1, graId)//
				.list();
	}

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoList(java.lang.String, java.lang.String, int)
	 */
	@Override
	public List<ClassInfo> findClassInfoList(String sclId, String graId,
			int statusFlag) {
		return getSession().createQuery(//
				"FROM ClassInfo c WHERE c.sclId = ? AND c.graId = ? AND c.clsStatusFlag = ? ORDER BY c.clsName")//
				.setParameter(0, sclId)//
				.setParameter(1, graId)//
				.setParameter(2, statusFlag)//
				.list();
	}

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoListBySclId(java.lang.String)
	 */
	@Override
	public List<ClassInfo> findClassInfoListBySclId(String sclId) {
		return getSession().createQuery(//
				"FROM ClassInfo c WHERE c.sclId = ? ORDER BY c.clsName")//
				.setParameter(0, sclId)//
				.list();
	}

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoListBySclId(java.lang.String, int)
	 */
	@Override
	public List<ClassInfo> findClassInfoListBySclId(String sclId, int statusFlag) {
		return getSession().createQuery(//
				"FROM ClassInfo c WHERE c.sclId = ? AND c.clsStatusFlag = ? ORDER BY c.clsName")//
				.setParameter(0, sclId)//
				.setParameter(1, statusFlag)//
				.list();
	}

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoListByClsId(java.lang.String)
	 */
	@Override
	public List<ClassInfo> findClassInfoListByGraId(String graId) {
		return getSession().createQuery(//
				"FROM ClassInfo c WHERE c.graId = ? ORDER BY c.clsName")//
				.setParameter(0, graId)//
				.list();
	}

	/**
	 * @see com.kh.pajx.bmp.dao.school.IClassInfoDao#findClassInfoListByClsId(java.lang.String, int)
	 */
	@Override
	public List<ClassInfo> findClassInfoListByGraId(String graId, int statusFlag) {
		return getSession().createQuery(//
				"FROM ClassInfo c WHERE c.graId = ? AND c.clsStatusFlag = ? ORDER BY c.clsName")//
				.setParameter(0, graId)//
				.setParameter(1, statusFlag)//
				.list();
	}

}
